<?php
class masession{
	function __construct(){
		session_start();
	}
	public function add($nom,$value){
		$_SESSION[$nom]=$value;
	}
	public function val($nom){
		return $_SESSION[$nom];	
	}
	public function destroy(){
		$this->reset();
		session_destroy();
	}
	public function reset(){
		foreach($_SESSION as $key=>$value){
			unset($_SESSION[$key]);
		}
	}
	public function isEmpty(){
		return sizeOf($_SESSION)==0;
	}
	public function exist($nom){
		return isset($_SESSION[$nom]);
	}
	public function toString(){
		$str="[";
		foreach($_SESSION as $key=>$value){
			$str.=$key.":".$value."\n";
		}
		$str.="]";
		return $str;
	}
}

?>
